const Router = require('koa-router');
const chatController = require('../controllers/chatController.js'); 
const authMiddleware = require('../middlewares/auth');

const router = new Router({ prefix: '/api/chat' });

// 删除不存在的路由引用
// const aiRoutes = require('./routes/ai');
// app.use('/api/ai', aiRoutes);

router.post('/query', authMiddleware, chatController.chat);
router.post('/send', authMiddleware, chatController.chat);
router.get('/history', authMiddleware, chatController.getHistory);

// 添加获取对话详情的路由
router.get('/detail/:id', authMiddleware, chatController.getChatDetail);
router.delete('/delete/:id', authMiddleware, chatController.deleteChat);
router.put('/update/:id', authMiddleware, chatController.updateChat);
router.delete('/clear-all', authMiddleware, chatController.clearAllChats);

module.exports = router;